<template>
  <div class="editCom">
    <div class="container">
      <div class="top">
        <span>指标解释</span>
        <img :src="imgUrl" alt @click="$store.state.labelExplainState=false" />
      </div>
      <div class="top_center">
        <span>数据来源</span>
        <span :title="$store.state.dataFrom">{{$store.state.dataFrom}}</span>
      </div>
      <div class="contanin">{{$store.state.labelExplainData}}</div>
      <input type="hidden" :value="$store.state.labelExplainData" />
      <!-- 确定取消 -->
      <div class="bottom">
        <div @click="fuzhi()">复制到粘贴板</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'editCom',
  data () {
    return {
      imgUrl: require('../../../static/nav/deleteImg.png')
    }
  },
  methods: {
    fuzhi () {
      var input = document.createElement('input')
      input.setAttribute('readonly', 'readonly') // 防止手机上弹出软键盘
      input.setAttribute('value', this.$store.state.labelExplainData)
      document.body.appendChild(input)
      // input.setSelectionRange(0, 9999);
      input.select()
      document.execCommand('copy')
      document.body.removeChild(input)
      this.$alert('已经复制到粘贴板！', '温馨提示', {
        confirmButtonText: '确定'
      })
      // alert('已经复制到粘贴板！')
    }
  }
}
</script>
<style lang="scss" scoped>
.editCom {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  & > .container {
    width: 43.3125rem;
    height: 44.125rem;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    & > .top {
      margin-top: 1rem;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      width: 38.375rem;
      height: 3.875rem;
      border-bottom: 0.125rem solid #bdbdbd;
      & > span {
        font-size: 1.375rem;
        font-weight: normal;
        font-stretch: normal;
        letter-spacing: 0rem;
        color: #333333;
      }
      & > img {
        width: 1.3125rem;
        height: 1.3125rem;
      }
      & > img:hover {
        cursor: pointer;
      }
    }
    & > .top_center {
      margin-top: 0.6rem;
      width: 38.375rem;
      height: 3.925rem;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      // border: 1px solid red;
      & > span {
        padding: 0.12rem;
      }
      & > span:nth-child(1) {
        font-size: 0.875rem;
        font-weight: bold;
      }
      & > span:nth-child(2) {
        padding: 0 0.32rem;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
      }
      & > span:nth-child(2):hover {
        cursor: pointer;
      }
    }
    & > .titles {
      margin: 1rem 0;
      width: 38.375rem;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      & > div:nth-child(1) {
        & > input {
          margin: 0 0.5rem;
        }
        & > input:hover {
          cursor: pointer;
        }
      }
      & > div:nth-child(2) {
        & > span {
          margin: 0 0.5rem;
        }
        & > span:hover {
          cursor: pointer;
        }
      }
    }
    & > .contanin {
      margin-top: 1rem;
      padding: 0.5rem;
      width: 37.375rem;
      height: 24rem;
      font-size: 1.125rem;
      font-weight: normal;
      font-stretch: normal;
      line-height: 2rem;
      letter-spacing: 0rem;
      color: #666666;
      overflow: auto;
      background-color: #eeeeee;
    }
    & > .bottom {
      width: 38.375rem;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: flex-start;
      & > div:nth-child(1) {
        width: 15.625rem;
        height: 3.1875rem;
        background-color: #52b6e3;
        border-radius: 0.3125rem;
        font-size: 1.25rem;
        font-weight: normal;
        font-stretch: normal;
        letter-spacing: 0rem;
        color: #ffffff;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
      }
      & > div:nth-child(2) {
        width: 15.625rem;
        height: 3.1875rem;
        border: solid 0.125rem #dbdbdb;
        border-radius: 0.3125rem;
        font-size: 1.25rem;
        font-weight: normal;
        font-stretch: normal;
        letter-spacing: 0rem;
        color: #666666;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
      }
      & > div {
        margin: 3rem 1.2rem;
      }
      & > div:hover {
        cursor: pointer;
      }
    }
  }
}
</style>
